// 注册
Vue.component('component2', {
	props: ['current_page','jump_page','page_total'],
  	template: 
  	'<div style="padding-top: 20px;overflow: hidden;padding-bottom: 10px;">\
  		<div class="col-sm-3" style="float: right;">\
			<div class="col-sm-5" style="max-width: 100px;">\
				<span style="position: absolute;left: -2px;top: 7px;">第</span><input type="text" v-model="jump_page" class="form-control col-sm-12 text-center" ><span style="position: absolute;right: -2px; top:7px;"> 页 </span>\
			</div>\
			<button type="button" class="btn btn-success" style="float: left;margin-left: 20px;" @click="ChangePage(jump_page,0)">跳转</button>\
			<div class="pull-right" style="margin: 8px 15px;">共<span v-text="page_total"></span>页</div>\
			<ul class="pagination" style="margin-top: 1px;margin-bottom: 0;float: right;">\
				<li><a @click="ChangePage(current_page,-1)">&laquo;</a></li>\
				<li><a v-text="current_page"></a></li>\
				<li><a @click="ChangePage(current_page,1)">&raquo;</a></li>\
			</ul>\
		</div>\
  	</div>',
  	data:function(){
  		return {
//			myPage : this.page //①创建props属性result的副本--myResult
		};
  	},
  	methods:{
  		test:function(val){
  			console.log(val)
//			this.myPage = val
  		},
  		ChangePage:function(page,index){
  			this.$emit("page-change",page,index);//③组件内对myResult变更后向外部发送事件通知
  		}
  	} ,
  	watch: {
        current_page(val) {        	
        	console.log('aaaa')
//          this.myPage = val;//②监听外部对props属性result的变更，并同步到组件内的data属性myResult中
//          this.$emit("page-change",val);//③组件内对myResult变更后向外部发送事件通知
        },
        myPage(val){
//          this.$emit("page-change",val);//③组件内对myResult变更后向外部发送事件通知
        }
    }
})


